<template>
  <div class="aui-card-list">
    <uni-list-query-card :queryShow="queryShow" @query-click="getDataList()" @click="(e)=>{this.queryShow=e}" @searchReset="searchReset()">
      <el-col :span="6">
        <el-form-item :label="$t('msgDingtalkRecord.bizId')">
          <el-input v-model="dataForm.bizId" :placeholder="$t('msgDingtalkRecord.bizId')" clearable></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item :label="$t('msgDingtalkRecord.templateId')">
          <el-input v-model="dataForm.templateId" :placeholder="$t('msgDingtalkRecord.templateId')" clearable></el-input>
        </el-form-item>
      </el-col>
    </uni-list-query-card>
    <el-card shadow="never" class="aui-card-list-body">
      <vxe-toolbar :setting="{immediate:true}">
        <template v-slot:buttons>
        </template>
        <template v-slot:tools>
          <el-button icon="el-icon-refresh" @click="getDataList()" circle></el-button>
          <el-dropdown trigger="click" style="padding-left: 5px;" placement="bottom">
            <el-button icon="el-icon-download" circle>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item icon="el-icon-bottom" @click.native="exportHandle(true)">导出当前页</el-dropdown-item>
              <el-dropdown-item icon="el-icon-download" @click.native="exportHandle()">全部导出
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </vxe-toolbar>
      <div class="aui-card-list-body-table">
        <vxe-table :loading="dataListLoading" :data="dataList" ref="xTable" auto-resize class="vxe-table-element" remote-sort @sort-change="dataListSortChangeHandle" max-height="auto">
          <vxe-table-column type="index" width="50" align="center"></vxe-table-column>
          <vxe-table-column field="templateId" title="msgDingtalkRecord.templateId" align="center" width="100">
          </vxe-table-column>
          <vxe-table-column field="content" title="msgDingtalkRecord.content"></vxe-table-column>
          <vxe-table-column field="contentParam" title="msgDingtalkRecord.contentParam"></vxe-table-column>
          <vxe-table-column field="resultMsg" title="msgDingtalkRecord.resultMsg"></vxe-table-column>
          <vxe-table-column field="receiver" title="msgDingtalkRecord.receiver"></vxe-table-column>
          <vxe-table-column field="createDate" title="common.createDate" width="140" align="center"></vxe-table-column>
          <vxe-table-column field="bizId" title="msgDingtalkRecord.bizId"></vxe-table-column>
          <vxe-table-column field="status" title="common.status" width="100" align="center">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.status === 1" type="success" size="small">{{ $t('mail.status1') }}</el-tag>
              <el-tag v-else size="small" type="danger">{{ $t('mail.status0') }}</el-tag>
            </template>
          </vxe-table-column>
          <vxe-table-column title="handle" fixed="right" width="80" align="center">
            <template slot-scope="scope">
              <el-button v-if="$hasPermission('msg:msgDingtalkRecord:delete')" type="text" icon="el-icon-delete" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}
              </el-button>
            </template>
          </vxe-table-column>
        </vxe-table>
        <el-pagination :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle" @current-change="pageCurrentChangeHandle">
        </el-pagination>
        <!-- 弹窗, 新增 / 修改 -->
        <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
      </div>
    </el-card>
  </div>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './msgDingtalkRecord-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/msg/msgDingtalkRecord/page',
        getDataListIsPage: true,
        deleteURL: '/msg/msgDingtalkRecord',
        deleteIsBatch: true,
        exportURL: '/msg/msgDingtalkRecord/export'
      },
      dataForm: {
        bizId: '',
        templateId: ''
      }
    }
  },
  components: {
    AddOrUpdate
  }
}
</script>
